/**
 * @author: zouye<yzyngz@foxmail.com>
 * @date: 2022-01-04 23:01:21
 * @copyright: zouye<yzyngz@foxmail.com>
 */
package com.yeah.voice.recognition.common;

import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

/**
 * 配置文件相关实体类，同时支持从配置文件获取和从启动参数中获取
 */
@Configuration
public class Properties implements ApplicationRunner{
	 @Value("${voice.location}")
	 private String voiceLocation;
	 
	 @Value("${people.answer.count}")
	 private Integer peopleAnswerCount;
	 
	 @Value("${people.voice.count}")
	 private Integer peopleVoiceCount;

	 @Value("${valid.voice.name}")
	 private String validVoiceName;

	 @Value("${valid.voice.order}")
	 private Integer validVoiceOrder;
	 
	 @Value("${mark.tone.list}")
	 private String markToneList;
	 
	 @Value("${stop.after.play.second}")
	 private Integer stopAfterPlaySecond;
	 
	 @Value("${answer.after.play.second}")
	 private Integer answerAfterPlaySecond;
	 
	 @Value("${replay.count}")
	 private Integer replayCount;
	 
	 @Value("${reset.ismarking.after.minute}")
	 private Integer resetIsMarkingAfterMinute;
	 
	 @Value("${system.is.update}")
	 private Integer isSystemUpdate;

	/**
	 * @return the voiceLocation
	 */
	public String getVoiceLocation() {
		return voiceLocation;
	}

	/**
	 * @param voiceLocation the voiceLocation to set
	 */
	public void setVoiceLocation(String voiceLocation) {
		this.voiceLocation = voiceLocation;
	}
	

	/**
	 * @return the peopleMarkCount
	 */
	public Integer getPeopleAnswerCount() {
		return peopleAnswerCount;
	}

	/**
	 * @param peopleMarkCount the peopleMarkCount to set
	 */
	public void setPeopleAnswerCount(Integer peopleAnswerCount) {
		this.peopleAnswerCount = peopleAnswerCount;
	}

	/**
	 * @return the peopleVoiceCount
	 */
	public Integer getPeopleVoiceCount() {
		return peopleVoiceCount;
	}

	/**
	 * @param peopleVoiceCount the peopleVoiceCount to set
	 */
	public void setPeopleVoiceCount(Integer peopleVoiceCount) {
		this.peopleVoiceCount = peopleVoiceCount;
	}

	@Override
	public void run(ApplicationArguments args) throws Exception {
		if (args.containsOption("voice.location")) {
			List<String> list = args.getOptionValues("voice.location");
			if (list != null && !list.isEmpty()) {
				this.setVoiceLocation(list.get(0));
			}
		}
	}



	public String getValidVoiceName() {
		return validVoiceName;
	}

	public void setValidVoiceName(String validVoiceName) {
		this.validVoiceName = validVoiceName;
	}

	public Integer getValidVoiceOrder() {
		return validVoiceOrder;
	}

	public void setValidVoiceOrder(Integer validVoiceOrder) {
		this.validVoiceOrder = validVoiceOrder;
	}

	public String getMarkToneList() {
		return markToneList;
	}

	public void setMarkToneList(String markToneList) {
		this.markToneList = markToneList;
	}

	public Integer getStopAfterPlaySecond() {
		return stopAfterPlaySecond;
	}

	public void setStopAfterPlaySecond(Integer stopAfterPlaySecond) {
		this.stopAfterPlaySecond = stopAfterPlaySecond;
	}

	public Integer getAnswerAfterPlaySecond() {
		return answerAfterPlaySecond;
	}

	public void setAnswerAfterPlaySecond(Integer answerAfterPlaySecond) {
		this.answerAfterPlaySecond = answerAfterPlaySecond;
	}

	public Integer getReplayCount() {
		return replayCount;
	}

	public void setReplayCount(Integer replayCount) {
		this.replayCount = replayCount;
	}

	public Integer getResetIsMarkingAfterMinute() {
		return resetIsMarkingAfterMinute;
	}

	public void setResetIsMarkingAfterMinute(Integer resetIsMarkingAfterMinute) {
		this.resetIsMarkingAfterMinute = resetIsMarkingAfterMinute;
	}

	public Integer getIsSystemUpdate() {
		return isSystemUpdate;
	}

	public void setIsSystemUpdate(Integer isSystemUpdate) {
		this.isSystemUpdate = isSystemUpdate;
	}

}
